<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<!-- RichFaces tag library declaration -->
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="../css/cssMain.css" />
<title>Вход в системата</title>
</head>
<body>
<f:view>
	<h:form styleClass="topMargin">
		<rich:panel id="loginPanel" styleClass="login">
			<h:panelGrid>
				<h:outputText value="Нямате регистрация?" />
				<a4j:commandButton value="Направете я от тук." id="linkNewSt"
					action="#{mbLogin.resetNewUser}" reRender="mdlNewStudent"
					oncomplete="Richfaces.showModalPanel('mdlNewStudent');">
				</a4j:commandButton>
			</h:panelGrid>
			<h:panelGrid columns="2">
				<h:outputText value="Потребителско име" />
				<h:inputText value="#{mbLogin.currUser.username}" />
				<h:outputText value="Парола" />
				<h:inputSecret value="#{mbLogin.currUser.password}" />
			</h:panelGrid>
			<a4j:commandButton value="Влез" action="#{mbLogin.recognizeUser}"
				reRender="loginPanel" />
			<br />
			<rich:messages errorClass="errorText" infoClass="errorText" />
		</rich:panel>
	</h:form>
	<rich:modalPanel id="mdlNewStudent" autosized="true" width="350">
		<f:facet name="header">
			<h:panelGroup>
				<h:outputText value="Регистриране на нов студент"></h:outputText>
			</h:panelGroup>
		</f:facet>
		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage value="../img/close.png" id="hidelink5" />
				<rich:componentControl for="mdlNewStudent" attachTo="hidelink5"
					operation="hide" event="onclick" />
			</h:panelGroup>
		</f:facet>
		<h:form>
			<h:panelGrid columns="2">
				<h:outputText value="Потребителско име" />
				<h:inputText value="#{mbLogin.newStudent.username}" />
				<h:outputText value="Парола" />
				<h:inputSecret value="#{mbLogin.newStudent.password}" />
				<h:outputText value="Повтори парола" />
				<h:inputSecret value="#{mbLogin.validatePass}" />
				<h:outputText value="Име" />
				<h:inputText value="#{mbLogin.newStudent.firstName}" />
				<h:outputText value="Презиме" />
				<h:inputText value="#{mbLogin.newStudent.secondName}" />
				<h:outputText value="Фамилия" />
				<h:inputText value="#{mbLogin.newStudent.thirdName}" />
				<h:outputText value="E-mail" />
				<h:inputText value="#{mbLogin.newStudent.mail}" />
				<h:outputText value="ЕГН" />
				<h:inputText value="#{mbLogin.newStudent.egn}" />
				<h:outputText value="Факултетен номер" />
				<h:inputText value="#{mbLogin.newStudent.fn}" />
				<h:outputText value="Специалност" />
				<rich:comboBox value="#{mbLogin.newStudent.specialty.name}"
					enableManualInput="false">
					<f:selectItems value="#{mbLogin.nomSpecialties}" />
				</rich:comboBox>
				<h:outputText value="Код за регистрация" />
				<h:inputText value="#{mbLogin.registerCode}" />
			</h:panelGrid>
			<a4j:commandButton value="Регистрирай ме"
				action="#{mbLogin.createNewStudent}" reRender="validationRegister" />
			<h:panelGrid id="validationRegister">
				<h:messages layout="table" style="color:red; font-size:14px" />
			</h:panelGrid>
		</h:form>
	</rich:modalPanel>
</f:view>
</body>
</html>